import SDKAdatper from "../core/SDKAdatper";
import AdAdapter from "../core/AdAdapter";

let runtime: any = 'loadRuntime'
export default class CocosSDK extends SDKAdatper {

    createBannerAd(obj: any) {
        if (!this.hasBannerAd()) {
            return null;
        }
        return new AdAdapter(this._sdk.createBannerAd(obj.key, obj.adUnitId, obj.num))
    }

    createInterstitialAd(obj: any) {
        if (!this.hasSDK()) {
            return null;
        }

        return new AdAdapter(this._sdk.createInterstitialAd(obj.key, obj.adUnitId, obj.num))

    }


    createRewardedVideoAd(obj: any) {
        if (!this.hasSDK() || !this._sdk.createRewardedVideoAd) {
            return null;
        }

        return new AdAdapter(this._sdk.createRewardedVideoAd(obj.key, obj.adUnitId, obj.num))

    }
    getDataPath() {

        let rt = window['runtime']();
        return rt.env.USER_DATA_PATH + '/'
    }

    getFileSystemManager() {
        let rt = window['runtime']();
        return rt.getFileSystemManager();

    }
}